﻿@model IEnumerable<Common.Views.CartView>

@{
    ViewBag.Title = "Your Items to Purchase";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<h2>View Cart</h2>
@ViewBag.Message

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

@using (Html.BeginForm()) {
    
<table>
    <tr>
        <th>Product Name</th>
        <th>Image</th>
        <th>Quantity</th>
        <th>Price</th>

    </tr>

@foreach (var item in Model)
{

    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.ProductName)
        </td>
        <td>
            <img height="150px" width="150px" src= "@Url.Content(item.ProductImage)" alt="@Html.DisplayFor(modelItem => item.ProductImage)" />
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Quantity)
        </td>
        <td>
            @(item.Quantity * item.Price)
        </td>
    </tr>
}
    <tr>
        <td></td>
        <td></td>
        <td>Total Price:</td>
        <td>€@ViewBag.TotalPrice</td>
    </tr>
    <tr>
        <td></td>
        <td></td>
        <td></td>
        <td> <input type="submit" value="CheckOut"/> </td>
    </tr>
</table>
}